<?php

require_once "/../Data/Html.php";

class RegistrationView extends Html
{
	/* Member variables */
	private static $newUserName = "newUserName";
	private static $newUserValue = "";
	private static $newPassword = "newPassword";
	private static $newPassValue = "";
	private static $newPasswordConfirm = "newPasswordConfirm";
	private static $newPassConValue = "";
	
	private static $addUserButton = "addUserButton";
	private static $removeUserButton = "removeUserButton";
	
	/* Generates and returns a header in HTML format */
	public function DoHeader($headerSize = "2")
	{
		return Html::Div(Html::H("Register", $headerSize, "registerHeader"), "headerDiv");
	}
		
	/* Generats and returns a registration form in Html format*/
	public function DoRegistrationBox()
	{
		return Html::Div(
			"<form method='post' action=''>
				<div class='registrationInputDiv'>
					<div class='inputDiv'>
						<img src='Gfx/user.svg' alt='user' width='32' height='32' class='inputIcon' />
						<input type='text' name='" . self::$newUserName . "'
						value='" . self::$newUserValue . "' class='loginNameBox' />
					</div>
					<div class='inputDiv'>
						<img src='Gfx/keyhole.svg' alt='password' width='32' height='32' class='inputIcon'/>
						<input type='password' name='" . self::$newPassword . "'
						value='" . self::$newPassValue . "' class='loginPassBox' />
					</div>
					<div class='inputDiv'>
						<img src='Gfx/keyhole.svg' alt='password' width='32' height='32' class='inputIcon'/>
						<input type='password' name='" . self::$newPasswordConfirm . "'
						value='" . self::$newPassConValue . "' class='loginPassBox' />
					</div>
					<div>
						<input type='submit' name='" . self::$addUserButton . "' value='Add' />
					</div>
					<div>
						<input type='submit' name='" . self::$removeUserButton . "' value='Remove' />
					</div>
				</div>
			</form>", "registrationDiv");
	}
	
	public function GetUsername()
	{
		if (!isset($_POST[self::$newUserName]))
			return NULL;
		
		return $_POST[self::$newUserName];
	}
	
	public function GetPassword()
	{
		if (!isset($_POST[self::$newPassword]))
			return NULL;
		
		return $_POST[self::$newPassword];
	}
	
	public function GetPasswordConfirmation()
	{
		if (!isset($_POST[self::$newPasswordConfirm]))
			return NULL;
		
		return $_POST[self::$newPasswordConfirm];
	}
	
	public function TriedToAddUser()
	{
		return isset($_POST[self::$addUserButton]);
	}
	
	public function TriedToRemoveUser()
	{
		return isset($_POST[self::$removeUserButton]);
	}
	
	/* Generates and returns a user-remove form in Html format */
	public function DoRemoveUserBox()
	{
		return "";
	}
}